package com.bjpowernode.gateway.web.model.query;

import com.bjpowernode.gateway.common.utils.KqUtil;
import com.bjpowernode.gateway.common.utils.Pkipair;
import lombok.Data;

/**
 * 异步通知基本数据接口 下的实现类 ,
 * 根据形参传入的数据 确定执行的是哪一个子类数据模型
 */
@Data
public class KqNoticeQeury implements NoticeBaseQeury {
    String merchantAcctId;
    String version;
    String language;
    String signType;
    String payType;
    String bankId;
    String orderId;
    String orderTime;
    String orderAmount;
    String bindCard = "";
    String bindMobile = "";
    String dealId;
    String bankDealId;
    String dealTime;
    String payAmount;
    String fee;
    String ext1;
    String ext2;
    String payResult;
    String aggregatePay;
    String errCode;
    String signMsg;

    /**
     * 检查签名
     * @return
     */
    public boolean checkSignMsg() {
        String merchantSignMsgVal = "";
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal,"merchantAcctId", merchantAcctId);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "version",version);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "language",language);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "signType",signType);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "payType",payType);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "bankId",bankId);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "orderId",orderId);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "orderTime",orderTime);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "orderAmount",orderAmount);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "bindCard",bindCard);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "bindMobile",bindMobile);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "dealId",dealId);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "bankDealId",bankDealId);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "dealTime",dealTime);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "payAmount",payAmount);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "fee", fee);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "ext1", ext1);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "ext2", ext2);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "payResult",payResult);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "aggregatePay",aggregatePay);
        merchantSignMsgVal = KqUtil.appendParam(merchantSignMsgVal, "errCode",errCode);
        System.out.println("merchantSignMsgVal="+merchantSignMsgVal);
        Pkipair pki = new Pkipair();
        boolean flag = pki.enCodeByCer(merchantSignMsgVal, signMsg);
        return flag;
    }
}
